// KWFWLib.cpp native assembly code template.
// KW-Software embedded CLR native assembly builder tool generated source file.
// use this file to implement your own native code

#include "eclr.h"
#include "KWFWLib.h"

extern "C" void debugout(const char *fmt,...);
extern "C" int read_bit(int number);
extern "C" int write_bit(int number,int value);
bool KWFWLib::init()
{
// if necessary, insert some initialization code for the KWFWLib library here !
// call KWFWLib::init() somewhere before KWFWLib::loadLibrary() is called.
// loadLibrary() have to be called after the ClrContoller object is instanciated
// for detailed information see the native library builder documentation
    return true;
}

bool KWFWLib::isCompatible(const EclrVersion& requestedVersion)
{
// this function is called by the runtime if an application will be bound
// to this library with the requested version.
// return true means that this library fits to the requested interface.
// return false forces the runtime to search for other libraries with the same name by calling isCompatible()
// if no libraries could be found, the runtime breaks the loading process with linker-error
// for multiple library version support read the documentation.
    return true;
}

bool KWFWLib::load(ClrAppDomain* pAppDomain)
{
// This function is called by the runtime if an application will be started.
// pAppDomain is the domain object witch hosts the current application process.
// At this point, the firmware library is able to initialize some internal objects.
// If the initialization is done ok, return true
// othewise return false.
    return true;
}

bool KWFWLib::unload(ClrAppDomain* pAppDomain)
{
// This function is called by the runtime if an application will be terminated.
// pAppDomain is the domain object witch hosts the current application process.
// At this point, the firmware library is able to finalize some internal objects.
// If the finalization is done ok, return true
// othewise return false.
    return true;
}

// class KWFWLib.ReadBit implementation
Int32 __PInvoke__ KWFWLib::ReadBit::__Process(Int32 p0)
{
// implement your code here !
    return read_bit(p0);
}

KWFWLib::ReadBit::ReadBit()
{
// implement your constructor code here !
}

void __PInvoke__ KWFWLib::ReadBit::ctor()
{
// automatically generated auxiliary contructor : calls the contructor by displacement new operator !
// @Begin automatically generated code, do not modify !
    new (this) KWFWLib::ReadBit();
// @End automatically generated code
}

// class KWFWLib.WriteBit implementation
Int32 __PInvoke__ KWFWLib::WriteBit::__Process(Int32 p0, Int32 p1)
{
// implement your code here !
    return write_bit(p0, p1);
}

KWFWLib::WriteBit::WriteBit()
{
// implement your constructor code here !
}

void __PInvoke__ KWFWLib::WriteBit::ctor()
{
// automatically generated auxiliary contructor : calls the contructor by displacement new operator !
// @Begin automatically generated code, do not modify !
    new (this) KWFWLib::WriteBit();
// @End automatically generated code
}

// class KWFWLib.Print implementation
KWFWLib::Print::Print()
{
// implement your constructor code here !
}

void __PInvoke__ KWFWLib::Print::ctor()
{
// automatically generated auxiliary contructor : calls the contructor by displacement new operator !
// @Begin automatically generated code, do not modify !
    new (this) KWFWLib::Print();
// @End automatically generated code
}

void __PInvoke__ KWFWLib::Print::__Init()
{
// implement your code here !
	m_temp = 0;
}

void __PInvoke__ KWFWLib::Print::__Process()
{
// implement your code here !
	if (m_temp == 0 && Triger != 0)
	{
		debugout((const char*)String.Begin());
	}
	
	m_temp = Triger;
}

// class KWFWLib.Button implementation
KWFWLib::Button::Button()
{
// implement your constructor code here !
}

void __PInvoke__ KWFWLib::Button::ctor()
{
// automatically generated auxiliary contructor : calls the contructor by displacement new operator !
// @Begin automatically generated code, do not modify !
    new (this) KWFWLib::Button();
// @End automatically generated code
}

void __PInvoke__ KWFWLib::Button::__Init()
{
// implement your code here !
}

void __PInvoke__ KWFWLib::Button::__Process()
{
// implement your code here !
}

// class KWFWLib.LED implementation
KWFWLib::LED::LED()
{
// implement your constructor code here !
}

void __PInvoke__ KWFWLib::LED::ctor()
{
// automatically generated auxiliary contructor : calls the contructor by displacement new operator !
// @Begin automatically generated code, do not modify !
    new (this) KWFWLib::LED();
// @End automatically generated code
}

void __PInvoke__ KWFWLib::LED::__Init()
{
// implement your code here !
}

void __PInvoke__ KWFWLib::LED::__Process()
{
// implement your code here !
}

// class KWFWLib.ADC implementation
KWFWLib::ADC::ADC()
{
// implement your constructor code here !
}

void __PInvoke__ KWFWLib::ADC::ctor()
{
// automatically generated auxiliary contructor : calls the contructor by displacement new operator !
// @Begin automatically generated code, do not modify !
    new (this) KWFWLib::ADC();
// @End automatically generated code
}

void __PInvoke__ KWFWLib::ADC::__Init()
{
// implement your code here !
}

void __PInvoke__ KWFWLib::ADC::__Process()
{
// implement your code here !
}

